﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Stilovi_Clanak : System.Web.UI.Page
{

    KorisnickiDioUtility k;

    protected void Page_Load(object sender, EventArgs e)
    {
        k = new KorisnickiDioUtility();
        EnciklopedijaDrvecaModel.Clanak cl;
        if (Request.QueryString["id"] == null)
        {
            btnBack.Visible = false;
            try
            {
                cl=k.ClanakSadrzaj();
                clanakSadrzaj.InnerHtml = cl.TextClanka;
                Title = "Svijet Drveća - " + cl.NazivClanka;
            }
            catch
            {
                clanakSadrzaj.InnerHtml = k.nepostojecaStranica;
            }

        }
        else
        {
            int id;
            bool val = Int32.TryParse(Request.QueryString["id"], out id);
            if (val)
            {
                try
                {
                    cl = k.ClanakSadrzaj(id);
                    clanakSadrzaj.InnerHtml = cl.TextClanka;
                    Title = "Svijet Drveća - " + cl.NazivClanka;
                }
                catch
                {
                    clanakSadrzaj.InnerHtml = k.nepostojecaStranica;
                }

            }

            else
                clanakSadrzaj.InnerHtml = k.nepostojecaStranica;
        }
    }
}